package com.example.design.observer.rate;

import com.example.design.observer.rate.concreteobserver.ExportCompany;
import com.example.design.observer.rate.concreteobserver.ImportCompany;
import com.example.design.observer.rate.concretesubject.RMBRate;
import com.example.design.observer.rate.observer.Company;
import com.example.design.observer.rate.subject.Rate;

/**
 * @Description 观察者模式测试类
 * @ClassName ObserverTest
 * @Author Yumuhui
 * @Date 2020/5/16 0:20
 * @Version 1.0.0
 */
public class ObserverTest {

    public static void main(String[] args) {
        Rate rate = new RMBRate();
        Company observer1 = new ImportCompany();
        Company observer2 = new ExportCompany();
        rate.addObserver(observer1);
        rate.addObserver(observer2);
        rate.change(10);

        rate.change(-5);
    }
}
